package project.menu.mastermenu;

import project.controllers.Controller;
import project.controllers.Messager;
import project.controllers.Printer;
import project.menu.IMenu;
import project.menu.IMenuItem;
import project.work.Navigator;
import api.controller.IAutoservice;
import api.entitites.IMaster;

public class MasterByOrder implements IMenuItem{
	private String name= "Get master by order";
	private final Integer id= 2;
	private static IMenu submenu;
	private Controller controller;
	private Navigator navigator;
	
	public MasterByOrder(){
		controller= Controller.getInstance();
		navigator=Navigator.getInstance();
	}


	
	
	public Integer getId() {
		return id;
	}
	
	public void action(IAutoservice autoservice) {
		//getmasterbyorder
		IMaster master=autoservice.getMasterByOrder(controller.getNumberOrder());
		Printer.printMessage(Messager.ORDER_IS_PERFORMED_BY_MASTER+master.getNameMaster());
		navigator.drawMenu(submenu);
		
	}

	
	public String getNameItem() {
		
		return name;
	}

	public static void setSubmenu(IMenu menu){
		 submenu=menu;
	}

}
